/**
 * Created by Administrator on 2016/9/28.
 */
jQuery.fn.extend({
    autoHeight: function(){
        return this.each(function(){
            var $this = jQuery(this);
            if( !$this.attr('_initAdjustHeight') ){
                $this.attr('_initAdjustHeight', $this.outerHeight());
            }
            _adjustH(this).on('input', function(){
                _adjustH(this);
            });
        });
        /**
         * 重置高度
         * @param {Object} elem
         */
        function _adjustH(elem){
            var $obj = jQuery(elem);
            return $obj.css({height: $obj.attr('_initAdjustHeight'), 'overflow-y': 'hidden'})
                .height( elem.scrollHeight-40 );
        }
    }
});
// 使用
$(function(){
    $('textarea').autoHeight();
});
// fooerTab
$(function () {
    $('.footerTab>a').click(function () {
        var $t = $(this).index();
        $('.footerTab>a').removeClass();
        $(this).addClass('footerTab_current');
        switch($t)
        {
            case 0:
                $('.footerTab a').eq(0).children("img").attr("src","images/zhongchou2.png");
                $('.footerTab a').eq(1).children("img").attr("src","images/f2.png");
                $('.footerTab a').eq(2).children("img").attr("src","images/f3.png");
                $('.footerTab a').eq(3).children("img").attr("src","images/f4.png");
                $('.footerTab a').eq(4).children("img").attr("src","images/f5.png");
                break;
            case 1:
                $('.footerTab a').eq(0).children("img").attr("src","images/f1.png");
                $('.footerTab a').eq(1).children("img").attr("src","images/baitiao2.png");
                $('.footerTab a').eq(2).children("img").attr("src","images/f3.png");
                $('.footerTab a').eq(3).children("img").attr("src","images/f4.png");
                $('.footerTab a').eq(4).children("img").attr("src","images/f5.png");
                break;
            case 2:
                $('.footerTab a').eq(0).children("img").attr("src","images/f1.png");
                $('.footerTab a').eq(1).children("img").attr("src","images/f2.png");
                $('.footerTab a').eq(2).children("img").attr("src","images/licai2.png");
                $('.footerTab a').eq(3).children("img").attr("src","images/f4.png");
                $('.footerTab a').eq(4).children("img").attr("src","images/f5.png");
                break;
            case 3:
                $('.footerTab a').eq(0).children("img").attr("src","images/f1.png");
                $('.footerTab a').eq(1).children("img").attr("src","images/f2.png");
                $('.footerTab a').eq(2).children("img").attr("src","images/f3.png");
                $('.footerTab a').eq(3).children("img").attr("src","images/paihang2.png");
                $('.footerTab a').eq(4).children("img").attr("src","images/f5.png");
                break;
            case 4:
                $('.footerTab a').eq(0).children("img").attr("src","images/f1.png");
                $('.footerTab a').eq(1).children("img").attr("src","images/f2.png");
                $('.footerTab a').eq(2).children("img").attr("src","images/f3.png");
                $('.footerTab a').eq(3).children("img").attr("src","images/f4.png");
                $('.footerTab a').eq(4).children("img").attr("src","images/wode2.png");
                break;
        }
    })

})


